//
//  SHSearchAnimationViewController.m
//  youjian03
//
//  Created by Dadeso on 14/10/24.
//  Copyright (c) 2014年 com.shouhuobao. All rights reserved.
//

#import "SHSearchAnimationViewController.h"
#import "SHCourierQuotationListModel.h"
#import "SHCourierQuotationListController.h"

#import "ToastView.h"

// 支付宝头文件
#import "AlixPayOrder.h"
#import "PartnerConfig.h"
#import "DataSigner.h"
#import "AlixLibService.h"
// 支付宝头文件


static int courierNumber;

@interface SHSearchAnimationViewController ()

@property (strong,nonatomic) UIImageView * circleAnimationView;

@property (nonatomic,retain) UITableView * courierListTableView;

@property (nonatomic,retain) UIButton * comPlaintButton;

@property (nonatomic,copy) NSString *price;

@property (nonatomic,retain) UILabel * comTextLabel;


@end

@implementation SHSearchAnimationViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}
//
-(void)popViewController{
    [self.navigationController dismissViewControllerAnimated:YES completion:^{
        
    }];
}
/*
 
 *** 撤销按钮点击事件，请求接口
 
 */
-(void)rightBBIClick{
    if (IOS7) {
        //iOS7用alertView
        [[[UIAlertView alloc]initWithTitle:@"您要撤销此次订单吗？" message:nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil] show];
    }else if (IOS8){
        //iOS8用alertController
        //*    1
        UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"您要撤销此次订单吗？" message:@"" preferredStyle:UIAlertControllerStyleAlert];
        //*    2
        UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
            
        }];
        //*    3
        UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
            NSDictionary *dic = @{@"orderId":self.orderId,@"token":self.tokenKey};
            [SHHTTPTOOL PostWithDic:dic andAction:@"userCancleOrder" success:^(id responseObj) {
               
                [self.searchAnimationImageView stopAnimating];
                [self.searchAnimation invalidate];
                self.searchAnimation = nil;
                [_delegate cancelBtnClick];
                [self.navigationController dismissViewControllerAnimated:YES completion:^{
                    
                }];
            } failure:^(NSError *error) {
                
            }];
        }];
        
        //*    4
        // Add the actions.
        [alert addAction:cancelAction];
        [alert addAction:otherAction];
        //*    5
        [self presentViewController:alert animated:YES completion:nil];
    }
    
}
//alertView撤销动作
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    if (buttonIndex == 0) {
        
    }else if (buttonIndex == 1){
        NSDictionary *dic = @{@"orderId":self.orderId,@"token":self.tokenKey};
        [SHHTTPTOOL PostWithDic:dic andAction:@"userCancleOrder" success:^(id responseObj) {
            HMLog(@"撤销");
            [self.searchAnimationImageView stopAnimating];
            [self.searchAnimation invalidate];
            self.searchAnimation = nil;
            [_delegate cancelBtnClick];
            [self.navigationController dismissViewControllerAnimated:YES completion:^{
                
            }];
        } failure:^(NSError *error) {
            
        }];
    }
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    //jeolo
    //订阅通知 处理支付返回结果
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(returnPay:) name:FHJG object:nil];
    
 

    
    
    IOS7ForIOS6;
    self.title = @"等待回应";
    //颜色
    NSDictionary *attributes=[NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor],NSForegroundColorAttributeName,nil];
    [self.navigationController.navigationBar setTitleTextAttributes:attributes];
    
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = SHRectMake(260, 7, 60, 30);
    [btn setTitle:@"撤销" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(rightBBIClick) forControlEvents:UIControlEventTouchUpInside];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    //[self circleAnimation];
    [self searchAnimationNew];
    
    [self initLabelFrame:SHRectMake(70, 60, 80, 20) Font:20.0f TextColor:[UIColor grayColor] Text:@"已推送给"];
    [self initLabelFrame:SHRectMake(150, 48, 20, 36) Font:25.0f TextColor:[UIColor redColor] Text:[NSString stringWithFormat:@"%d",self.currentVoiceSendCount]];
    [self initLabelFrame:SHRectMake(170, 60, 80, 20) Font:20.0f TextColor:[UIColor grayColor] Text:@"位快递员"];
    [self initLabelFrame:SHRectMake(60, 90, 200, 20) Font:20.0f TextColor:[UIColor grayColor] Text:@"请耐心等候..."];
    
    [self searchAnimationTimer];
    
    //[self creatComplaintButton];
    
    // Do any additional setup after loading the view.
}
/**
 *  返回支付结果
 */
-(void)returnPay:(NSNotification *)note
{
   NSString *returnCode =  note.userInfo[@"key"];
    if ([returnCode isEqualToString:@"9000"])
    {
        MBProgressHUD  *HUD = [[MBProgressHUD alloc] initWithView:self.view];
        [self.view addSubview:HUD];
        HUD.labelText =@"支付成功";
        HUD.mode = MBProgressHUDModeText;
        
        [HUD showAnimated:YES whileExecutingBlock:^{
            sleep(2.5);
        } completionBlock:^{
            [HUD removeFromSuperview];
        }];

    }
    else
    {
        MBProgressHUD  *HUD = [[MBProgressHUD alloc] initWithView:self.view];
        [self.view addSubview:HUD];
        HUD.labelText =@"支付失败";
        HUD.mode = MBProgressHUDModeText;
        
        [HUD showAnimated:YES whileExecutingBlock:^{
            sleep(2.5);
        } completionBlock:^{
            [HUD removeFromSuperview];
        }];

        
    }
    
    [_delegate cancelBtnClick];
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(void)creatComplaintButton{
    UIButton * complaintBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    complaintBtn.frame = SHRectMakeRound(139 , 480 - 37 - 42, 42, 42);
    [complaintBtn setImage:[UIImage imageNamed:@"btn_complaint_normal"] forState:UIControlStateNormal];
    [complaintBtn setImage:[UIImage imageNamed:@"btn_complaint_pressed"] forState:UIControlStateHighlighted];
    [complaintBtn addTarget:self action:@selector(complaintViewBtnClick) forControlEvents:UIControlEventTouchUpInside];
    complaintBtn.hidden = YES;
    [self.courierListTableView addSubview:complaintBtn];
    self.comPlaintButton = complaintBtn;
    
    UILabel * label = [[UILabel alloc] initWithFrame:SHRectMake(0, 480 - 19 - 13, 320, 12)];
    label.text = @"打小报告";
    label.textColor = [SHUtilitiesTool colorWithHexString:@"#999999"];
    label.font = [UIFont systemFontOfSize:12.0f];
    label.hidden = YES;
    label.textAlignment = NSTextAlignmentCenter;
    [self.courierListTableView addSubview:label];
    self.comTextLabel = label;
}


-(void)searchAnimationTimer{
    self.searchAnimation = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(searchCountTime) userInfo:nil repeats:YES];
}


-(void)initLabelFrame:(CGRect)labelFrame Font:(CGFloat)labelFont TextColor:(UIColor *)textColor Text:(NSString *)labelText{
    UILabel * label = [[UILabel alloc] init];
    label.frame = labelFrame;
    label.font = [UIFont systemFontOfSize:labelFont];
    label.textColor = textColor;
    label.backgroundColor = [UIColor clearColor];
    label.textAlignment = NSTextAlignmentCenter;
    label.text = labelText;
    [self.view addSubview:label];
}

-(CGFloat)ToCalculateTheCellWidth:(UIFont *)labelFont andLabelText:(NSString *)labelText{
    
    NSDictionary *attrs = @{NSFontAttributeName : labelFont};
    CGFloat titleW = [labelText boundingRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size.width;
    return titleW;
}
/*
 
 *  每十秒请求一次，获得快递员信息
 
 */
-(void)searchCountTime{
    if (self.currentSearchTime % 10 == 0) {
        NSDictionary *dic = @{@"token":self.tokenKey};
        [SHHTTPTOOL PostOrderWithDic:dic andAction:@"userWaitingOrder" success:^(id responseObj) {
            NSDictionary * dict = [SHUtilitiesTool dictionaryWithJsonString:responseObj];
            NSDictionary * dict2 = dict[@"msg"];
            HMLog(@"dict2 is %@",dict2);
            self.currentVoiceSendCount =  [[dict2 objectForKey:@"count"] integerValue];
            NSLog(@"count is %@",[dict2 objectForKey:@"count"]);
            if ([dict2 objectForKey:@"count"] != nil) {
                courierNumber = [[dict2 objectForKey:@"count"] intValue];
            }
            [self.courierListArray removeAllObjects];
            if ([dict2 objectForKey:@"list"] != nil && [[dict2 objectForKey:@"list"] count] > 0) {
                for (NSDictionary * dicBub in [dict2 objectForKey:@"list"]) {
                    SHCourierQuotationListModel * dataModel = [[SHCourierQuotationListModel alloc] init];
                    dataModel.courierOfferId = [dicBub objectForKey:@"offerId"];
                    dataModel.courierStatus = [dicBub objectForKey:@"status"];
                    dataModel.courierAudio = [dicBub objectForKey:@"audio"];
                    dataModel.courierOfferTime = [dicBub objectForKey:@"offerTime"];
                    dataModel.courierName = [dicBub objectForKey:@"name"];
                    dataModel.courierPhone = [dicBub objectForKey:@"phone"];
                    dataModel.courierCompanyName = [dicBub objectForKey:@"companyName"];
                    dataModel.courierHeadico = [dicBub objectForKey:@"headico"];
                    dataModel.courierDuration = [dicBub objectForKey:@"duration"];
                    [self.courierListArray addObject:dataModel];
                }
                if (!self.courierListTableView) {
                    [self.searchAnimationImageView stopAnimating];
                    for (UIView * view in [self.view subviews]) {
                        [view removeFromSuperview];
                    }
                    self.orderState =  ORDER_STATE_RECIEVE_VOICE;
                    self.title = @"已回应";
                    [self creatCourierGetOrderTB];
                }else{
                    [self.courierListTableView reloadData];
                }
            }else{
//                if (self.courierListArray.count == 0 && self.courierListTableView) {
//                    [self initLabelFrame:SHRectMake(70, 60, 80, 20) Font:20.0f TextColor:[UIColor grayColor] Text:@"已推送给"];
//                    [self initLabelFrame:SHRectMake(150, 48, 20, 36) Font:25.0f TextColor:[UIColor redColor] Text:[NSString stringWithFormat:@"%d",self.currentVoiceSendCount]];
//                    [self initLabelFrame:SHRectMake(170, 60, 80, 20) Font:20.0f TextColor:[UIColor grayColor] Text:@"位快递员"];
//                    [self initLabelFrame:SHRectMake(60, 90, 200, 20) Font:20.0f TextColor:[UIColor grayColor] Text:@"请耐心等候..."];
//                }
               
            }
        } failure:^(NSError *error) {
            [ToastView showToastViewWithContent:@"搜索快递员失败" andRect:SHRectMake(100,200,120,80) andTime:2.0f andObject:self];
            [_delegate cancelBtnClick];
        }];
    }
    self.currentSearchTime ++;
}

/*
 
 * 订单go时推送给周围快递员的动画
 
 */
-(void)circleAnimation{
    UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"radar_sacnning"]];
    iv.frame = SHRectMake(0, 0, 200, 200);
    self.circleAnimationView  = iv;
    
    [self qiantai];
    
    UIImageView *back = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"radar_bg"]];
    back.frame = SHRectMake(60, 120, 200, 200);
    [back addSubview: self.circleAnimationView];
    [self.view addSubview: back];
}
//转圈动画
-(void)qiantai{
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
    animation.duration = 2.5;
    
    animation.repeatCount = NSIntegerMax;
    animation.fromValue = [NSNumber numberWithFloat:0];
    animation.toValue = [NSNumber numberWithFloat:2*M_PI];
    [self.circleAnimationView.layer addAnimation:animation forKey:@""];
}
/*
 
 * 搜索快递员新动画
 
 */
-(void)searchAnimationNew{
    UIImageView * imageView= [[UIImageView alloc] init];
    imageView.frame = SHRectMake(0, 0, 320, HMScreenH - 64);
    
    NSMutableArray * array = [[NSMutableArray alloc] init];
    for (int i = 1; i < 6; i++) {
        UIImage * imageName = [UIImage imageNamed:[NSString stringWithFormat:@"search_Animation_0%d",i]];
        [array addObject:imageName];
    }
    imageView.animationImages = array;
    imageView.animationDuration = 1.0;
    imageView.animationRepeatCount = 0;
    [self.view addSubview:imageView];
    self.searchAnimationImageView = imageView;
    [self.searchAnimationImageView startAnimating];
}

/*
 
 订单TableView
 
 */

//创建抢单快递列表
-(void)creatCourierGetOrderTB{
    UITableView * tableView = [[UITableView alloc] initWithFrame:SHRectMake(0, 0, HMScreenW, HMScreenH) style:UITableViewStyleGrouped];
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    //tableView.backgroundColor = [UIColor redColor];
    [self.view addSubview:tableView];
    self.courierListTableView = tableView;
    
    [self creatComplaintButton];
}
//section数量
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
//row根据刷新添加快递员
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if ([self.orderState isEqualToString:ORDER_STATE_RECIEVE_VOICE]) {
        return self.courierListArray.count;
    }else
        return 1;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return SHHEIGHT * 15.0f;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return SHHEIGHT * 206.0f;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString * cellName = [NSString stringWithFormat:@"courierList%d%d",indexPath.section,indexPath.row];
    SHCourierQuotationListCell * cell = [tableView dequeueReusableCellWithIdentifier:cellName];
    if (!cell) {
        cell = [[SHCourierQuotationListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.delegate = self;
    }
    if ([self.orderState isEqualToString:ORDER_STATE_RECIEVE_VOICE]) {
        [cell loadCell:self.courierListArray IndexPath:indexPath.row cellType:ORDER_STATE_RECIEVE_VOICE];
    }else if ([self.orderState isEqualToString:ORDER_STATE_WAIT_COURIER]){
        [cell loadCell:self.courierListArray  IndexPath:self.dataIndexPathRow cellType:ORDER_STATE_WAIT_COURIER];
    }
    return cell;
}
//已回应中同意按钮的点击事件
-(void)makeSureZheCourier:(NSInteger)indexPathRow{
    if ([self.orderState isEqualToString:ORDER_STATE_RECIEVE_VOICE]) {
        NSDictionary *dic = @{@"token":self.tokenKey,@"offerId":[[self.courierListArray objectAtIndex:indexPathRow] courierOfferId]};
        [SHHTTPTOOL PostOrderWithDic:dic andAction:@"userNailOrder" success:^(id responseObj) {
            HMLog(@"同意");
            [self.searchAnimation invalidate];
            self.searchAnimation = nil;
            self.orderState = ORDER_STATE_WAIT_COURIER;
            self.title = @"等待收件";
            self.dataIndexPathRow = indexPathRow;
            [self.courierListTableView reloadData];
            self.comTextLabel.hidden = NO;
            self.comPlaintButton.hidden = NO;
        } failure:^(NSError *error) {
            
        }];
    }else if ([self.orderState isEqualToString:ORDER_STATE_WAIT_COURIER]){
        
    }
}

-(void)textViewCountBeyond{
    [ToastView showToastViewWithContent:@"您的小报告字数已超出上限，请保持字数在140个字以内" andRect:SHRectMake(100,200,120,100) andTime:2.0f andObject:self
     ];
}
//小纸条按钮
-(void)complaintViewBtnClick{
    UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, HMScreenW, HMScreenH)];
    view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"mask_bg_view"]];
    view.tag = 535277;
    [[[UIApplication sharedApplication] keyWindow] addSubview:view];
    
    SHComplaintsView * views = [[SHComplaintsView alloc] init];
    views.tokenStr = self.tokenKey;
    views.delegate = self;
    views.deliverId = [[self.courierListArray objectAtIndex:self.dataIndexPathRow] courierOfferId];
    views.frame = SHRectMake(20, 84, HMScreenW -40, HMScreenH - 168);
    views.backgroundColor = [SHUtilitiesTool colorWithHexString:@"#f7f7f7"];
    views.layer.cornerRadius = 6;
    //views.alpha = 1.0;
    [view addSubview:views];
}

-(void)removeComplaintView{
    UIView * views = [(UIView *)[[UIApplication sharedApplication] keyWindow] viewWithTag:535277];
    [views removeFromSuperview];
}

-(void)disPlayToastView{
    [ToastView showToastViewWithContent:@"亲，你的小纸条已经成功汇报到班主任那里了" andRect:CGRectMake(100,200,120,80) andTime:2.0f andObject:self];
}
//已回应中拒绝按钮的点击事件
-(void)refuseZheCourier:(NSInteger)indexPathRow{
    if ([self.orderState isEqualToString:ORDER_STATE_RECIEVE_VOICE]) {
        NSDictionary *dic = @{@"token":self.tokenKey,@"offerId":[[self.courierListArray objectAtIndex:indexPathRow] courierOfferId]};
        [SHHTTPTOOL PostOrderWithDic:dic andAction:@"userIgnoreOffer" success:^(id responseObj) {
            HMLog(@"拒绝");
            [self.courierListArray removeObjectAtIndex:indexPathRow];
            //[self.courierListTableView reloadData];
            /*
             
             *** 拒绝回应后立即再次启动计时器
             
             */
            if (self.courierListArray.count == 0 && self.courierListTableView) {
                
                self.title = @"等待回应";
                
                [self.courierListTableView removeFromSuperview];
                
                [self.searchAnimation invalidate];
                self.searchAnimation = nil;
                //                    [self circleAnimation];
                [self searchAnimationNew];
                [self initLabelFrame:SHRectMake(70, 60, 80, 20) Font:20.0f TextColor:[UIColor grayColor] Text:@"已推送给"];
                [self initLabelFrame:SHRectMake(150, 48, 20, 36) Font:25.0f TextColor:[UIColor redColor] Text:[NSString stringWithFormat:@"%d",courierNumber]];
                [self initLabelFrame:SHRectMake(170, 60, 80, 20) Font:20.0f TextColor:[UIColor grayColor] Text:@"位快递员"];
                [self initLabelFrame:SHRectMake(60, 90, 200, 20) Font:20.0f TextColor:[UIColor grayColor] Text:@"请耐心等候..."];
                [self searchAnimationTimer];
            }
        } failure:^(NSError *error) {
            
        }];
    }else if ([self.orderState isEqualToString:ORDER_STATE_WAIT_COURIER]){
        
    }
}
////在线支付
-(void)onlinePayWithToken:(NSString *)token anddeliverId:(NSString *)deliverId{
    
    UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"支付订单" message:@"请输入金额" preferredStyle:UIAlertControllerStyleAlert];
    
    
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
        HMLog(@"The \"no Okay/Cancel\" alert's cancel action occured.");
    }];
 
    
    
    UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {

        NSString *token = [SHReturnToken returnTokenNo];
        NSString *price = self.price;
       
        [self TOPayWithtoken:token andDeliverId:deliverId andPrice:price];
        
        
    }];

    
    [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
        
        textField.keyboardType =UIKeyboardTypeNumberPad;

        
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleTextFieldTextDidChangeNotification:) name:UITextFieldTextDidChangeNotification object:textField];
        
        textField.secureTextEntry = NO;
        
        
        
        
        
    }];
    
    
    
    [alertController addAction:cancelAction];
    [alertController addAction:otherAction];
    
    [self presentViewController:alertController animated:YES completion:nil];
}
- (void)handleTextFieldTextDidChangeNotification:(NSNotification *)notification {
    UITextField *textField = notification.object;
    self.price = textField.text;
    // Enforce a minimum length of >= 5 characters for secure text alerts.
//    self.secureTextAlertAction.enabled = textField.text.length >= 5;
}

-(void)TOPayWithtoken:(NSString *)token andDeliverId:(NSString *)deliverId andPrice:(NSString *)price
{
  
     NSDictionary *dic =@{@"deliverId":deliverId,@"token":token,@"price":price};
    [SHHTTPTOOL PostOrderWithDic:dic andAction:@"userPayOrder" success:^(id responseObj) {
        
        
        NSDictionary * dict = [SHUtilitiesTool dictionaryWithJsonString:responseObj];
        NSString *str = ((NSDictionary *)dict[@"msg"])[@"sign"];
        
        NSString *orderString =str;
        
        
        
        // 4.打开支付宝,传递订单信息
        [AlixLibService payOrder:orderString AndScheme:@"youjian" seletor:@selector(paymentResultDelegate:) target:self];
        
        
    } failure:^(NSError *error) {
        
        
    }];
    
}



//
////等待寄件中现金支付按钮的点击事件
-(void)payCashMoney{
    NSDictionary *dic = @{@"token":self.tokenKey};
    [SHHTTPTOOL PostWithDic:dic andAction:@"userSendOrder" success:^(id responseObj) {
        HMLog(@"确认寄出jeolo");
        //TODO: 点击现金支付
        [_delegate cancelBtnClick];
        [self dismissViewControllerAnimated:NO completion:^{
            //发送通知
            [[NSNotificationCenter defaultCenter] postNotificationName:XJZF object:nil userInfo:nil];
            
        }];
        
        
        
        
        
    } failure:^(NSError *error) {
        
    }];
}


-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:YES];
    NSMutableArray * array = [[NSMutableArray alloc] init];
    self.courierListArray = array;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

 @end
